#!/usr/bin/env python3
# Created by han on 2016/7/4
import sys,os, hashlib

sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))

# obj = hashlib.md5()
# obj1 = hashlib.md5()
# with open("md5_test","rb") as test, open("md5_test1","wb") as test1:
#
#
#     print(test.tell())
#
# with open("md5_test1","rb") as test1:
#     test1.seek(3)
#     for i in test1:
#         print(i)
# #
# # obj1.update(a1)
#
# ret = obj.hexdigest()
# print(ret)

# a = public.GetFileMd5("D:\影音\python视频\day9\oldboy-1.avi")
# print(a)
#传输文件名称的时候要把md5完整校验传过去

import re, json,subprocess,os
# a = json.dumps({"han":123,"xu":456})
# x = "123"
# b = re.findall("^\{.*\}$",x)
# print(b)
# ret = subprocess.Popen("ls /home/han", shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
file_size = os.stat("D:\资料\python\oldboy13\jobs\day7").st_size
# print(file_size)

a = os.walk("D:\资料\python\oldboy13\jobs\day7")
size = 0
for root ,dirs ,files in a:
    size+= sum([os.path.getsize(os.path.join(root,name)) for name in files])
print(size,type(size))